1. Field of the Invention
This invention relates to a compile device, a compile method and a recording medium on which a compiler is recorded, which, when an object program including loops with conditional branch instructions is generated, obtains information necessary for generation of an object program including an optimum code for high-efficiency execution of the loops.
2. Description of the Related Art
Japanese Patent Laid-Open Application No. 63-53646 discloses a technique in which dynamic information counting means is provided for counting the number of times of the execution of respective sentences included in an object program to be executed, and calculating and preserving dynamic information composed of the average number of rotations (the average number of repetitions) of respective loops included in the object program and the average forming rate (true rate) of respective conditional expressions included in the respective loops. The dynamic information obtained by the dynamic information counting means at the time of compiling a source program is referred to so that an object program including an optimum code for high-efficiency execution of respective loops included in the source program can be generated.
With such a conventional technique, however, the dynamic information gathered by the dynamic information counting means, i.e., the average number of repetitions and the true rate in the object program, is not enough to generate an object program including an optimum code for high-efficiency execution of respective loops included in the source program.
Assuming that the object program is executed twice, both a case where respective loops are repeated 50 times for the first and second execution cycles of the object program, and a case where the respective loops are repeated 100 times for the first execution cycle alone result in an average number of 50 repetitions. Similarly, with the true rate, both a case where the first 50 times show "true" and the second 50 times show "false", and a case where "true" and "false" appear alternately result in an average true rate of 50%.
In the conventional technique, the average number of repetitions can not correctly impart the execution pattern of the loop to the compile device when the object program is executed plural times. Similarly, the true rate can not correctly impart to the compiler the true pattern of the conditional expression included in the loop. Thus, a problem arises that the compiler can not generate an object program including an optimum code for high-efficiency execution of the respective loops.